﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;

namespace GraphDrawer {
	public partial class MainMenu : UserControl {
		Root root;

		public MainMenu(Root root) {
			InitializeComponent();

			this.root = root;
		}

		private void DiseasesModels_Click(object sender, RoutedEventArgs e) {
			root.LoadDiseasesModels();
		}

		private void SocialNetworks_Click(object sender, RoutedEventArgs e) {
			root.LoadSocialNetworks();
		}

		private void Polls_Click(object sender, RoutedEventArgs e) {
			string relativeURL = "PollDesigner/NewPoll.aspx";
			Uri currentURL = HtmlPage.Document.DocumentUri;
			//string[] pathParts = currentURL.LocalPath.Split('/');
			int idx = currentURL.OriginalString.IndexOf(currentURL.LocalPath);
			string newURL = currentURL.OriginalString.Substring(0, idx + 1) + relativeURL;
			HtmlPage.Window.Navigate(new Uri(newURL), "_blank");
		}

		private void InoculationStrategies_Click(object sender, RoutedEventArgs e) {
			root.LoadInoculationStrategies();
		}

		private void SpreadVisualization_Click(object sender, RoutedEventArgs e) {
			root.LoadSpreadVisualization();
		}

		private void Reports_Click(object sender, RoutedEventArgs e) {
			root.LoadReports();
		}

		private void DiseasesModels_MouseEnter(object sender, MouseEventArgs e) {
			description.TextAlignment = TextAlignment.Center;
			description.VerticalAlignment = VerticalAlignment.Center;
			description.Text = "You will be moved to the disease models management module, "
				+ "where you will be able to add a new model, edit or delete an existing one.";
		}

		private void SocialNetworks_MouseEnter(object sender, MouseEventArgs e) {
			description.TextAlignment = TextAlignment.Center;
			description.VerticalAlignment = VerticalAlignment.Center;
			description.Text = "You will be moved to the social networks management panel. "
				+ "Unfortunately it's still being implemented.";
		}

		private void Polls_MouseEnter(object sender, MouseEventArgs e) {
			description.TextAlignment = TextAlignment.Center;
			description.VerticalAlignment = VerticalAlignment.Center;
			description.Text = "You will be moved to the polls management panel. "
				+ "Unfortunately it's still being implemented.";
		}

		private void InoculationStrategies_MouseEnter(object sender, MouseEventArgs e) {
			description.TextAlignment = TextAlignment.Center;
			description.VerticalAlignment = VerticalAlignment.Center;
			description.Text = "You will be moved to the module which will help you "
				+ "to make a decision which inoculation strategy should be chosen. It "
				+ "also will help you make a list containing people to vaccinate.";
		}

		private void SpreadVisualization_MouseEnter(object sender, MouseEventArgs e) {
			description.TextAlignment = TextAlignment.Center;
			description.VerticalAlignment = VerticalAlignment.Center;
			description.Text = "You will be moved to the disease spread visualization module. "
				+ "It will allow you to load a social network, a specific disease model, setup "
				+ "a simulation and see the simulation visualization.";
		}

		private void Reports_MouseEnter(object sender, MouseEventArgs e) {
			description.TextAlignment = TextAlignment.Center;
			description.VerticalAlignment = VerticalAlignment.Center;
			description.Text = "You will be moved to the reports module. It will allow you too "
				+ "start a simulation without visualization in order to estimate sick people count "
				+ "in the specific moment by showing you a chart.";
		}

		private void Button_Leave(object sender, MouseEventArgs e) {
			description.TextAlignment = TextAlignment.Left;
			description.VerticalAlignment = VerticalAlignment.Top;
			description.Text = "CARE system";
		}
	}
}
